<%@ page import="javax.jms.Session" %>
<%@ page import="com.mooc.po.User" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fuck" uri="/pager-tags" %>
<html>

<head>
	<meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
	<title>公开课列表 - 慕学在线网</title>
	<link rel="stylesheet" type="text/css" href="../../css/reset.css">
	<link rel="stylesheet" type="text/css" href="../../css/animate.css">
	<link rel="stylesheet" type="text/css" href="../../css/style.css">
    
    <script src="../../js/jquery.min.js" type="text/javascript"></script>
    <script src="../../js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        function add_fav_course(fav_id, fav_type){
            if($("#savesession").val()==""){
                var r = confirm("您还未登录，单击确定登录")
                if (r==true){
                    window.location.href="/login"
                }
            }
            $.ajax({
                type: "POST",
                url:"/org/add_fav",
                dataType:"json",
                data:JSON.stringify({'fav_id':fav_id, 'fav_type':fav_type}),
                contentType:"application/json;charset=utf-8",
                success: function(data) {
                    if(data.sta=="ok"){
                        var getid = document.getElementById("shownums"+fav_id);
                        var num = parseInt(getid.innerHTML)
                        getid.innerHTML = num+1;
                    }
                    if (data.sta=="no"){
                        var getid = document.getElementById("shownums"+fav_id);
                        var num = parseInt(getid.innerHTML)
                        getid.innerHTML = num-1;
                    }
                },
            });
        }
    </script>
    <script src="../../js/jquery.min.js" type="text/javascript"></script>
    <script src="../../../js/message.js" type="text/javascript"></script>
    <script src="../../js/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var ctx = "${sessionScope.user_session}";
    </script>
</head>
<body onload="setTimeout('getcount()',1000)">
<section class="headerwrap ">
    <header>
		<div  class=" header">
 			<div class="top">
				<div class="wp">
					<div class="fl"><p>服务电话：<b>13280797579</b></p></div>
					<!--登录后跳转-->
                    <c:choose>
                        <c:when test="${sessionScope.user_session!=null}">
                            <div class="personal">
                                <dl class="user fr">
                                    <dd>${sessionScope.user_session.username}<img class="down fr" src="${pageContext.request.contextPath}/images/top_down.png"/></dd>
                                    <dt><img width="20" height="20" src="${pageContext.request.contextPath}${sessionScope.user_session.image}"/></dt>
                                </dl>
                                <div class="userdetail">
                                    <dl>
                                        <dt><img width="80" height="80" src="${pageContext.request.contextPath}${sessionScope.user_session.image}"/></dt>
                                        <dd>
                                            <h2>${sessionScope.user_session.username}</h2>
                                            <p>用户</p>
                                        </dd>
                                    </dl>
                                    <div class="btn">
                                        <a class="personcenter fl" href="${pageContext.request.contextPath}/usercenter">进入个人中心</a>
                                        <a class="fr" href="${pageContext.request.contextPath}/logout">退出</a>
                                    </div>
                                </div>
                                <a href="/message">
                                    <div class="msg-num"><span id="MsgNum"></span></div>
                                </a>
                            </div>
                        </c:when>
                        <c:otherwise>
                            <a style="color:white" class="fr registerbtn" href="/register">注册</a>
                            <a style="color:white" class="fr loginbtn" href="${pageContext.request.contextPath}/login">登录</a>
                        </c:otherwise>
                    </c:choose>


				</div>
			</div>

            <div class="middle">
                <div class="wp">
                    <a href="/index"><img class="fl" src="../../images/logo.jpg"/></a>
                    <div class="searchbox fr">
                        <div class="selectContainer fl">
                            <span class="selectOption" id="jsSelectOption" data-value="course">
                                公开课
                            </span>
                            <ul class="selectMenu" id="jsSelectMenu">
                                <li data-value="course">公开课</li>
                                <li data-value="org">课程机构</li>
                                <li data-value="teacher">授课老师</li>
                            </ul>
                        </div>
                        <input id="search_keywords" class="fl" type="text" value="" placeholder="请输入搜索内容"/>
                        <img class="search_btn fr" id="jsSearchBtn" src="../../images/search_btn.png"/>
                    </div>
                </div>
            </div>
            
            
			<nav>
				<div class="nav">
					<div class="wp">
						<ul>
							<li ><a href="/index">首页</a></li>
							<li class="active">
								<a href="/course-list">
									公开课<img class="hot" src="../../images/nav_hot.png">
								</a>
							</li>
							<li >
								<a href="/showTeacherList">授课教师</a>
							</li>
							<li ><a href="/org_list">授课机构</a></li>
						</ul>
					</div>
				</div>
			</nav>
            
			</div>
    </header>
</section>
<!--crumbs start-->

    <section>
        <div class="wp">
            <ul  class="crumbs">
                <li><a href="/index">首页</a>></li>
                <li>公开课</li>
            </ul>
        </div>
    </section>


    <section>
	<div class="wp">
		<div class="list" style="margin-top:0;">
			<div class="left layout">
				<div class="head">
					<ul class="tab_header">
						<li <c:if test="${requestScope.sort=='new'}">class="active"</c:if>><a href="?sort=">最新 </a></li>
						<li <c:if test="${requestScope.sort=='fav'}">class="active"</c:if>><a href="?sort=fav">最热门</a></li>
						<li <c:if test="${requestScope.sort=='students'}">class="active"</c:if>><a href="?sort=students">参与人数</a></li>
					</ul>
				</div>
                <div id="inWindow">
                    <div class="tab_cont " id="content">
                        <input type="hidden" id="savesession" value="${sessionScope.user_session}">
					<div class="group_list">
                        <c:forEach items="${requestScope.courseList}" var="course">
                            <div class="box">
                                <a href="/course-detail?id=${course.id}">
                                    <img width="280" height="350" class="scrollLoading" src="${course.image}"/>
                                </a>
                                <div class="des">
                                    <a href="/course-detail?id=${course.id}">
                                        <h2>${course.name}</h2>
                                    </a>
                                    <span class="fl">时长：<i class="key">${course.learn_time}</i></span>
                                    <span class="fr">学习人数：${course.students}&nbsp;&nbsp;</span>
                                </div>
                                <div class="bottom">
                                    <a href="/course-list?id=${course.id}"><span class="fl">来自${course.organization.name}</span></a>
                                    <span class="star fr  notlogin" id="shownums${course.id}" onclick="add_fav_course(${course.id},3)">
                                            ${course.fav_nums}
                                    </span>
                                </div>
                            </div>
                        </c:forEach>


					</div>
                        <div style="margin-top: 60px"><fuck:pager
                                pageIndex="${requestScope.pageModel.pageIndex}"
                                pageSize="${requestScope.pageModel.pageSize}"
                                recordCount="${requestScope.pageModel.recordCount}"
                                submitUrl="${pageContext.request.contextPath}/course-list?pageIndex={0}"/>
                        </div>

                    </div>
				</div>
                </div>
			<div class="right layout">
				<div class="head">热门课程推荐</div>
				<div class="group_recommend">
                    <c:forEach items="${requestScope.courseList}" var="course" begin="0" end="${(requestScope.pageModel.pageSize div 4)-1}">
                        <dl>
                            <dt>
                                <a target="_blank" href="">
                                    <img width="240" height="220" class="scrollLoading" src="../../media/courses/2016/11/540e57300001d6d906000338-240-135_n0L8vbw.jpg"/>
                                </a>
                            </dt>
                            <dd>
                                <a target="_blank" href=""><h2> ${course.name}</h2></a>
                                <span class="fl">难度：<i class="key">${course.degree}</i></span>
                            </dd>
                        </dl>
                    </c:forEach>


				</div>
			</div>
        </div>
    </div>
</section>

<footer>
		<div class="footer">
			<div class="wp">
				<ul class="cont">
					<li class="logo"><a href=""><img src="../../images/footlogo.png"/></a></li>
					<li class="code"><img src="../../images/code.jpg"/><p class="center">扫描关注微信</p></li>
					<li class="third"><img class="fl" src="../../images/tell.png"/><p class="tell">13280797579</p><p class="time">周一至周日 9:00-18:00</p></li>
				</ul>

			</div>
			<p class="line"></p>
			<div class="wp clear">
                <span class="fl">? 2016 www.projectsedu.com 慕学在线-在线学习交流平台 保留所有权利</span>
                <span class="fr">copyright ? 2016 ICP备案证书号：蜀ICP备xxxxx号-1</span>
			</div>
		</div>
	</footer>

<section>
    <ul class="sidebar">
        <li class="qq">
            <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=2023525077&site=qq&menu=yes"></a>
        </li>
        <li class="totop"></li>
    </ul>
</section>
<script src="../../js/selectUi.js" type='text/javascript'></script>
<script src="../../js/deco-common.js" type='text/javascript'></script>
<script type="text/javascript" src="../../js/plugins/laydate/laydate.js"></script>
<script src="../../js/plugins/layer/layer.js"></script>
<script src="../../js/plugins/queryCity/js/public.js" type="text/javascript"></script>
<script src="../../js/unslider.js" type="text/javascript"></script>
<script src="../../js/plugins/jquery.scrollLoading.js"  type="text/javascript"></script>
<script src="../../js/deco-common.js"  type="text/javascript"></script>
<script src="../../js/selectUi.js" type='text/javascript'></script>
<script type="text/javascript" src="../../js/plugins/laydate/laydate.js"></script>
<script src="../../js/plugins/layer/layer.js"></script>
<script src="../../js/plugins/queryCity/js/public.js" type="text/javascript"></script>
<script src="../../js/selectUi.js" type='text/javascript'></script>
<script src="../../js/deco-common.js" type='text/javascript'></script>
<script type="text/javascript" src="../../js/plugins/laydate/laydate.js"></script>
<script src="../../js/plugins/layer/layer.js"></script>
<script src="../../js/plugins/queryCity/js/public.js" type="text/javascript"></script>
<script src="../../js/unslider.js" type="text/javascript"></script>
<script src="../../js/plugins/jquery.scrollLoading.js"  type="text/javascript"></script>
<script src="../../js/deco-common.js"  type="text/javascript"></script>

<script type="text/javascript" src="../../js/index.js"></script>
<script type="text/javascript" src="../../js/plugins/jquery.raty.js"></script>
</body>
</html>
